﻿#include "MeshGeometry.h"

D3D12_VERTEX_BUFFER_VIEW FMeshGeometry::GetVertexBufferView() const
{
    D3D12_VERTEX_BUFFER_VIEW VertexBufferView;
    VertexBufferView.BufferLocation = VertexBufferGPU->GetGPUVirtualAddress();
    VertexBufferView.StrideInBytes = VertexByteStride;
    VertexBufferView.SizeInBytes = VertexBufferByteSize;

    return VertexBufferView;
}

D3D12_INDEX_BUFFER_VIEW FMeshGeometry::GetIndexBufferView() const
{
    D3D12_INDEX_BUFFER_VIEW IndexBufferView;
    IndexBufferView.BufferLocation = IndexBufferGPU->GetGPUVirtualAddress();
    IndexBufferView.Format = IndexFormat;
    IndexBufferView.SizeInBytes = IndexBufferByteSize;

    return IndexBufferView;
}

void FMeshGeometry::DisposeUploaders()
{
    VertexBufferUploader = nullptr;
    IndexBufferUploader = nullptr;
}
